package com.ss.android.newmedia;

import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.TextView;

import com.bytedance.common.utility.Logger;
import com.ss.android.newmedia.a.AdsAppBaseActivity;
import com.ss.android.push.window.oppo.OppoPushWindowManager;

final class p implements Runnable {
    public final BaseApplication b;
    public final String a;

    p(BaseApplication arg1, String arg2) {
        this.b = arg1;
        this.a = arg2;
    }

    public final void run() {
        WindowManager.LayoutParams v1_1;
        View v3;
        Object v0_3;
        Intent v2;
        try {
            String v0_1 = this.a;
            String v1 = Uri.parse(v0_1).getScheme().toLowerCase();
            if (TextUtils.isEmpty(((CharSequence) v1))) {
                return;
            }

            if (("sslocal".equals(v1)) || ("localsdk".equals(v1))) {
                v0_1 = AdsAppBaseActivity.b(v0_1);
            }

            Uri v0_2 = Uri.parse(v0_1);
            v2 = new Intent();
            v2.setData(v0_2);
            v2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            if (AdsAppBaseActivity.c(v1)) {
                v2.putExtra("is_from_self", true);
            }

            if (!TextUtils.isEmpty(Build.MANUFACTURER) && (Build.MANUFACTURER.toLowerCase().contains("oppo"))) {
                v0_3 = this.b.getContext().getSystemService("window");
                v3 = LayoutInflater.from(this.b.getContext()).inflate(com.ss.android.article.browser.R.layout.h6, null);
                ((TextView) v3.findViewById(com.ss.android.article.browser.R.id.a7i)).setText(this.b.getContext().getString(com.ss.android.article.browser.R.string.ls));
                v1_1 = new WindowManager.LayoutParams();
                v1_1.height = -2;
                v1_1.width = -2;
                v1_1.format = -3;
                v1_1.windowAnimations = 16973828;
                v1_1.type = OppoPushWindowManager.a(this.b.getContext()).g;
                v1_1.flags = 128;
                v1_1.setTitle("Toast");
                v1_1.gravity = 81;
                v1_1.y = ((int) TypedValue.applyDimension(1, 60f, this.b.getContext().getResources().getDisplayMetrics()));
                try {
                    ((WindowManager) v0_3).addView(v3, ((ViewGroup.LayoutParams) v1_1));
                } catch (Exception v1_2) {
                    try {
                        if (Logger.debug()) {
                            v1_2.printStackTrace();
                        }
                    } catch (Exception v0) {
                        return;
                    }

                    try {
                        ((WindowManager) v0_3).removeViewImmediate(v3);
                    } catch (Exception v) {
                    }
                }

                this.b.c.post(new q(this, v2, ((WindowManager) v0_3), v3));
                return;
            }

            this.b.getContext().startActivity(v2);
            return;
        } catch (Exception v0) {
            return;
        }
    }
}

